home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / k3bcdrdaowriter.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-05-27  |  3.9 KB  |  158 lines

  1. /*
  2.  *
  3.  * $Id: k3bcdrdaowriter.h 619556 2007-01-03 17:38:12Z trueg $
  4.  * Copyright (C) 2003 Sebastian Trueg <trueg@k3b.org>
  5.  *                    Klaus-Dieter Krannich <kd@k3b.org>
  6.  *
  7.  * This file is part of the K3b project.
  8.  * Copyright (C) 1998-2007 Sebastian Trueg <trueg@k3b.org>
  9.  *
  10.  * This program is free software; you can redistribute it and/or modify
  11.  * it under the terms of the GNU General Public License as published by
  12.  * the Free Software Foundation; either version 2 of the License, or
  13.  * (at your option) any later version.
  14.  * See the file "COPYING" for the exact licensing terms.
  15.  */
  16.  
  17.  
  18. #ifndef K3B_CDRDAO_WRITER_H
  19. #define K3B_CDRDAO_WRITER_H
  20.  
  21.  
  22. #include "k3babstractwriter.h"
  23.  
  24. class K3bExternalBin;
  25. class K3bProcess;
  26. class KProcess;
  27. class K3bDevice::Device;
  28. class QSocket;
  29.  
  30.  
  31.  
  32. class K3bCdrdaoWriter : public K3bAbstractWriter
  33. {
  34.   Q_OBJECT
  35.  
  36.  public:
  37.  
  38.   enum Command { WRITE, COPY, READ, BLANK };
  39.   enum BlankMode { FULL, MINIMAL };
  40.   enum SubMode { None, RW, RW_RAW };
  41.  
  42.   K3bCdrdaoWriter( K3bDevice::Device* dev, K3bJobHandler*, 
  43.            QObject* parent = 0, const char* name = 0 );
  44.   ~K3bCdrdaoWriter();
  45.  
  46.   /**
  47.    * to be used in chain: addArgument(x)->addArgument(y)
  48.    */
  49.   K3bCdrdaoWriter* addArgument( const QString& );
  50.   K3bDevice::Device* sourceDevice() { return m_sourceDevice; };
  51.  
  52.   int fd() const;
  53.  
  54.   bool active() const;
  55.  
  56.  private:
  57.   void reinitParser();
  58.   void parseCdrdaoLine( const QString& line );
  59.   void parseCdrdaoWrote( const QString& line );
  60.   void parseCdrdaoError( const QString& line ); 
  61.  
  62.  public slots:
  63.   void start();
  64.   void cancel();
  65.  
  66.   // options
  67.   // ---------------------
  68.   void setCommand( int c ) { m_command = c; }
  69.   void setBlankMode( int b ) { m_blankMode = b; }
  70.   void setMulti( bool b ) { m_multi = b; }
  71.   void setForce( bool b ) { m_force = b; }
  72.   void setOnTheFly( bool b ) { m_onTheFly = b; }
  73.   void setDataFile( const QString& s ) { m_dataFile = s; }
  74.   void setTocFile( const QString& s ) { m_tocFile = s; }
  75.  
  76.   void setSourceDevice( K3bDevice::Device* dev ) { m_sourceDevice = dev; }
  77.   void setFastToc( bool b ) { m_fastToc = b; }
  78.   void setReadRaw( bool b ) { m_readRaw = b; }
  79.   void setReadSubchan(SubMode m) { m_readSubchan=m; };
  80.   void setParanoiaMode( int i ) { m_paranoiaMode = i; }
  81.   void setTaoSource(bool b) { m_taoSource=b; };
  82.   void setTaoSourceAdjust(int a) { m_taoSourceAdjust=a; };
  83.   void setSession(int s) { m_session=s; };
  84.   void setEject(bool e) { m_eject=e; };  
  85. // ---------------------
  86.  
  87.   /**
  88.    * If set true the job ignores the global K3b setting
  89.    * and does not eject the CD-RW after finishing
  90.    */
  91.   void setForceNoEject( bool b ) { m_forceNoEject = b; }
  92.  
  93.  private slots:
  94.   void slotStdLine( const QString& line );
  95.   void slotProcessExited(KProcess*);
  96.   void parseCdrdaoMessage();
  97.   void slotThroughput( int t );
  98.  
  99.  private:
  100.   void unknownCdrdaoLine( const QString& );
  101.   void prepareArgumentList();
  102.   void setWriteArguments();
  103.   void setReadArguments();
  104.   void setCopyArguments();
  105.   void setBlankArguments();
  106.   void setCommonArguments();
  107.  
  108.   bool cueSheet();
  109.  
  110.   QString findDriverFile( const K3bExternalBin* bin );
  111.   bool defaultToGenericMMC( K3bDevice::Device* dev, bool writer );
  112.  
  113.   // options
  114.   // ---------------------
  115.   int        m_command;
  116.   int        m_blankMode;
  117.   K3bDevice::Device* m_sourceDevice;
  118.   QString    m_dataFile;
  119.   QString    m_tocFile;
  120.   QString    m_cueFileLnk;
  121.   QString    m_binFileLnk;
  122.   QString m_backupTocFile;
  123.   bool       m_readRaw;
  124.   bool       m_multi;
  125.   bool       m_force;
  126.   bool       m_onTheFly;
  127.   bool       m_fastToc;
  128.   SubMode    m_readSubchan;
  129.   bool       m_taoSource;
  130.   int        m_taoSourceAdjust;
  131.   int        m_paranoiaMode;
  132.   int        m_session;
  133.   bool       m_eject;
  134.   // ---------------------
  135.  
  136.   const K3bExternalBin* m_cdrdaoBinObject;
  137.   K3bProcess* m_process;
  138.  
  139.   int m_cdrdaoComm[2];
  140.   QSocket         *m_comSock;
  141.  
  142.   bool m_canceled;
  143.  
  144.   bool m_knownError;
  145.  
  146. // parser
  147.  
  148.   int m_size;
  149.   int m_currentTrack;
  150.  
  151.   bool m_forceNoEject;
  152.  
  153.   class Private;
  154.   Private* d;
  155. };
  156.  
  157. #endif
  158.